import { defineStore } from "pinia";
import request from '@/utils/request'
import { ApiRes, GoodsInfo } from "@/types/data";

// 复制后记得修改 name
export default defineStore('goods', {
  state: () => ({
    info: {} as GoodsInfo
  }),
  actions: {
    async getGoodsInfo(id: string) {
      const res = await request.get<ApiRes<GoodsInfo>>('/goods', {
        params: {
          id
        }
      })
      this.info = res.data.result
    }
  },
  getters: {}
})